#include<stdio.h>
#include <string.h>
int main(void)
{
    /*********Begin*********/
int i,j,count,cd,max,length;
	char a[100];
	while(1){
		gets(a);
		length=strlen(a);
		cd=0;
		count=0;
		max=0;
		if(strcmp(a,"stop")==0)
            break;
		else{

		for(i=0;i<=length;i++){

		if(a[i]!=' '&&a[i]!='\0'){
		count++;
		cd++;
		}
		else if(a[i]==' '||a[i]=='\0'){
		if(count>max){
		max=count;
		j=i;
		}
		count=0;
		}
		}
		printf("%d ",cd);
		for(i=j-max;i<j;i++) printf("%c",a[i]);
		putchar('\n');
	}
	}

    /*********End**********/
    return 0;
}